home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / utils1 / 2m21src.zip / 2MFBOTDD.ASM < prev    next >
Assembly Source File  |  1994-05-31  |  4KB  |  101 lines

  1.  
  2. ;┌───────────────────────────────────────────────────────────────────┐
  3. ;│                                                                   │
  4. ;│     2MFBOTDD 2.1  -  (C) Mayo 1994  Ciriaco García de Celis.      │
  5. ;│                                                                   │
  6. ;│         FICHERO CON CODIGO ENSAMBLADOR LINKABLE CON 2MF.C         │
  7. ;│                                                                   │
  8. ;│         Con código del sector de arranque para discos DD.         │
  9. ;│                                                                   │
  10. ;└───────────────────────────────────────────────────────────────────┘
  11.  
  12. _DATA          SEGMENT WORD PUBLIC 'DATA'
  13.                ASSUME  CS:_DATA, DS:_DATA
  14.  
  15.                PUBLIC  _BootDDPrg, _BootDDPrgLong
  16.  
  17. _BootDDPrg:    CLI
  18.                XOR   AX,AX
  19.                MOV   SS,AX
  20.                MOV   SP,7C00h          ; SS:SP inicializado
  21.                MOV   AX,07C0h
  22.                PUSH  AX
  23.                PUSH  AX
  24.                POP   DS
  25.                POP   ES
  26.                MOV   SI,0000h
  27.                MOV   DI,0200h
  28.                MOV   CX,0100h
  29.                CLD
  30.                REP   MOVSW             ; auto-reubicar este código
  31.                MOV   AX,07E0h
  32.                PUSH  AX
  33.                PUSH  AX
  34.                PUSH  AX
  35.                POP   DS
  36.                POP   ES
  37.                MOV   BX,DS:[68]        ; constante de reubicación
  38.                LEA   AX,[BX+OFFSET boot_ini - OFFSET _BootDDPrg]
  39.                PUSH  AX
  40.                RETF                    ; saltar a boot_ini reubicado
  41. boot_ini:      STI
  42.                MOV   BX,DS:[68]        ; constante de reubicación
  43.                PUSH  BX                ; *
  44.                LEA   BX,[BX+OFFSET info_txt - OFFSET _BootDDPrg]
  45.                CALL  print
  46.                MOV   AH,0
  47.                INT   16h               ; esperar por una tecla
  48.                POP   BX                ; *
  49.                LEA   BX,[BX+OFFSET crlf_txt - OFFSET _BootDDPrg]
  50.                CALL  print
  51.                XOR   AX,AX
  52.                MOV   ES,AX
  53.                MOV   BX,7C00h          ; ES:BX = 0000:7C00
  54.                MOV   AX,0201h          ; leer un sector
  55.                MOV   CX,0001h          ; el sector 1 del cilindro 0
  56.                MOV   DX,0080h          ; y cabezal 0 del disco duro
  57.                PUSH  ES
  58.                PUSH  BX
  59.                INT   13h               ; cargar tabla de particiones
  60.                JNC   rd_ok
  61.                CMP   AH,11h            ; ¿error ECC corregido?
  62.                JNE   err_boot
  63. rd_ok:         CMP   WORD PTR ES:[7DFEh],0AA55h
  64.                JNE   err_boot
  65.                XOR   AX,AX
  66.                MOV   DS,AX
  67.                RETF                    ; ejecutar tabla de particiones
  68. err_boot:      MOV   BX,DS:[68]
  69.                LEA   BX,[BX+OFFSET noboot_txt - OFFSET _BootDDPrg]
  70.                CALL  print
  71.                MOV   AX,40h
  72.                MOV   DS,AX
  73.                MOV   WORD PTR DS:[72h],1234h  ; evitar chequeo memoria
  74.                MOV   AH,0
  75.                INT   16h                      ; esperar tecla
  76.                DB    0EAh
  77.                DW    0, 0FFFFh                ; jmp ffff:0000
  78. print:         MOV   AL,[BX]
  79.                AND   AL,AL             ; carácter 0: fin del mensaje
  80.                JNZ   print_car
  81.                RET
  82. print_car:     PUSH  BX
  83.                MOV   AH,0Eh
  84.                MOV   BX,7
  85.                INT   10h               ; imprimir carácter
  86.                POP   BX
  87.                INC   BX
  88.                JMP   print
  89.  
  90. info_txt       DB    13,10,"2M 2.1",13,10
  91.                DB    " - Disquete DD: Pulsa una tecla para botar del disco duro...",13,10
  92.                DB    " - DD diskette: Press any key to boot from your hard disk...",0
  93. noboot_txt     DB    " ¡Error!: Pulsa una tecla - Press any key...",0
  94. crlf_txt       DB    13,10,10,0
  95.  
  96. _BootDDPrgLong DW    $-OFFSET _BootDDPrg
  97.  
  98. _DATA          ENDS
  99.  
  100.                END
  101.